package com.wondertek.poms.dao.pojo;

import cn.hutool.core.date.DateUtil;
import com.wondertek.poms.dao.po.EquityNode;
import lombok.Data;

import java.util.Collection;

@Data
public class EquityNodePojo {

    private Long id;// 权益节点id
    private Long treeId; // 权益树id 对应EquityTree的id
    private String equityNodeId;// 权益节点编码
    private Long groupId; // 关联组id
    private String groupName;
    private Long parentId;// 父权益节点 第一级的父权益节点 0
    private String nodeAlias;// 节点别名
    private String status;
    private String createTime;
    private Integer hierarchy; // 层级
    private String name;

    //private Boolean expanded;
    private Collection<EquityNodePojo> children;

    private String parentEquityNodeId;
    private String updateTime;

    public EquityNodePojo(){

    }

    public EquityNodePojo(EquityNode equityNode, String parentEquityNodeId) {
        this.equityNodeId = equityNode.getEquityNodeId();
        this.name = equityNode.getName();
        this.nodeAlias = equityNode.getNodeAlias();
        this.parentEquityNodeId = parentEquityNodeId;
        this.hierarchy = equityNode.getHierarchy();
        this.createTime = DateUtil.formatDate(equityNode.getCreateTime());
        this.updateTime = DateUtil.formatDate(equityNode.getUpdateTime());
        this.status = equityNode.getStatus();
        this.groupId = equityNode.getGroupId();
    }

    public EquityNodePojo(EquityNode equityNode) {
        this.id = equityNode.getId();
        this.treeId = equityNode.getTreeId();
        this.equityNodeId = equityNode.getEquityNodeId();
        this.groupId = equityNode.getGroupId();
        this.parentId = equityNode.getParentId();
        this.nodeAlias = equityNode.getNodeAlias();
        this.status = equityNode.getStatus();
        this.createTime = DateUtil.formatDateTime(equityNode.getCreateTime());
        this.hierarchy = equityNode.getHierarchy();
        this.name = equityNode.getName();
        //this.expanded = true;
    }
}
